package util.utls;

import android.annotation.SuppressLint;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


/**
 * 
 * @author 格式化时间戳
 * 
 */
public class TimeFormat {
	static String time;

	public static String DateFormat(String s) {
		DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		try {
			long ictiime = Long.valueOf(s);
			time = sdf.format(new Date(ictiime * 1000L));
		} catch (Exception e) {
			// TODO: handle exception
		}

		return time;

	}

	public static String getCurrentTime(String format) {
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.getDefault());
		String currentTime = sdf.format(date);
		return currentTime;
	}

	public static String DateFormat01(String s) {
		DateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		try {
			long ictiime = Long.valueOf(s);
			time = sdf.format(ictiime);
		} catch (Exception e) {
			// TODO: handle exception
		}

		return time;

	}
	public static String getOnData() {
		SimpleDateFormat sDateFormat = new SimpleDateFormat(
				"ss");
		String date = sDateFormat.format(new java.util.Date());
		return date;
	}
	public static String getCurrentTime() {
		return getCurrentTime("yyyy-MM-dd  HH:mm:ss");
	}

	/**
	 * 获取当前时间
	 * 
	 * @return
	 */
	@SuppressLint("SimpleDateFormat")
	public static String getSimData() {
		SimpleDateFormat sDateFormat = new SimpleDateFormat(
				"yyyy-MM-dd hh:mm");
		String date = sDateFormat.format(new Date());
		return date;
	}
}
